# 二分查找
data = [1, 3, 4, 5, 6]


def binary_search(alist, number):
    left = 0
    right = len(alist) - 1
    while left <= right:
        mid = (left + right) // 2
        if alist[mid] == number:
            return mid
        elif alist[mid] < number:
            left += 1
        else:
            right -= 1


index = binary_search(data, 1)
print(index)
